unit BillCheck;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses,
  uniGUIClasses, uniGUIFrame, uniBasicGrid, uniDBGrid, uniScreenMask,
  uniFileUpload, DB, DBClient, ClientRowSet, uniGUIBaseClasses, uniStatusBar,
  uniButton, uniBitBtn, uniEdit, uniLabel, uniPanel;

type
  TFrmBillCheck = class(TUniFrame)
    UniStatusBar1: TUniStatusBar;
    dsBill: TDataSource;
    crsBill: TClientRowSet;
    StringField49: TStringField;
    StringField50: TStringField;
    StringField51: TStringField;
    StringField52: TStringField;
    IntegerField9: TIntegerField;
    StringField53: TStringField;
    StringField54: TStringField;
    StringField55: TStringField;
    StringField56: TStringField;
    StringField57: TStringField;
    StringField58: TStringField;
    StringField59: TStringField;
    StringField60: TStringField;
    StringField61: TStringField;
    StringField62: TStringField;
    FloatField7: TFloatField;
    IntegerField10: TIntegerField;
    IntegerField11: TIntegerField;
    StringField63: TStringField;
    StringField64: TStringField;
    StringField65: TStringField;
    StringField66: TStringField;
    StringField67: TStringField;
    StringField68: TStringField;
    StringField69: TStringField;
    StringField70: TStringField;
    StringField71: TStringField;
    StringField72: TStringField;
    StringField73: TStringField;
    StringField74: TStringField;
    StringField75: TStringField;
    StringField76: TStringField;
    StringField77: TStringField;
    FloatField8: TFloatField;
    FloatField9: TFloatField;
    FloatField10: TFloatField;
    FloatField11: TFloatField;
    FloatField12: TFloatField;
    StringField78: TStringField;
    StringField79: TStringField;
    StringField80: TStringField;
    StringField81: TStringField;
    StringField82: TStringField;
    StringField83: TStringField;
    StringField84: TStringField;
    StringField85: TStringField;
    StringField86: TStringField;
    StringField87: TStringField;
    StringField88: TStringField;
    IntegerField12: TIntegerField;
    StringField89: TStringField;
    StringField90: TStringField;
    StringField91: TStringField;
    StringField92: TStringField;
    IntegerField13: TIntegerField;
    StringField93: TStringField;
    StringField94: TStringField;
    StringField95: TStringField;
    IntegerField14: TIntegerField;
    IntegerField15: TIntegerField;
    StringField96: TStringField;
    IntegerField16: TIntegerField;
    ScreenMask: TUniScreenMask;
    GridBill: TUniDBGrid;
    UniPanel1: TUniPanel;
    UniLabel1: TUniLabel;
    edbillno: TUniEdit;
    btFind: TUniBitBtn;
    btConfirm: TUniBitBtn;
    procedure btFindClick(Sender: TObject);
    procedure btConfirmClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure ShowUnCloseBill(billno:String);
  end;

implementation
uses billmodule,expModule;

{$R *.dfm}



{ TFrmBillCheck }

procedure TFrmBillCheck.btConfirmClick(Sender: TObject);
begin
  if not crsbill.Active then exit;
  
  crsBill.Edit;
  crsBill.FieldByName('keeper').AsString := dmexpress.UserInfo.UserNo;
  crsBill.ApplyUpdates;
end;

procedure TFrmBillCheck.btFindClick(Sender: TObject);
begin
  ShowUnCloseBill(edbillno.Text);
end;

procedure TFrmBillCheck.ShowUnCloseBill(billno: String);
var
  sqltxt:String;
begin
  sqltxt := 'select * from exp_abill where '+
            'sys_account=' + quotedstr(dmexpress.UserInfo.SysAccount) +
            ' and state=0';
  if billno <> '' then
    sqltxt := sqltxt + ' and bill_no=' + quotedstr(billno);
  crsBill.Close;
  crsBill.CommandText := sqltxt;
  crsBill.Open;

end;

end.
